<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="k in msg">{{k}}</li>
        </ul>
        <input type="text" v-model="bot"> <button @click="fn">发送</button>
    </div>
</body>

</html>
<script src="./vue2.js"></script>
<script src="./axios.js"></script>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                bot: '',
                msg: [],
                key: 'v3HDY4BmxN9RQ5c8rVyzkABv',
                Secret: 'u5MVmhZn4l5Bu9rHUaHUotUGMGtPLFk8'
            }
        },
        methods: {
            fn() {
                this.msg.push(this.bot)

                // 获取token
                axios({
                    method: 'post',
                    url: 'http://127.0.0.1:3006/ai/bot',
                    data: {
                        msg: this.bot
                    }
                }).then(res => {
                    this.msg.push(res.data.data.result)
                    console.log(res.data.data.result);
                    this.bot = ''
                })

            }
        }
    })
</script>